#============================================================
#	Player Jump
#============================================================
# @datetime: 2022-4-27 23:32:49
#============================================================
class_name PlayerJump
extends PlayerBaseState

var _jump_timer = create_timer()


#(override)
func enter():
	_jump_timer.start(0.2)

#(override)
func state_process(_arg0):
	input_move()
	
	if input_attack():
		switch_to(PlayerStateBlackboard.States.ATTACK)
	else:
		input_jump()
	
	if get_host().is_on_floor(): 
		if get_blackboard().is_moving():
			switch_to(PlayerStateBlackboard.States.MOVE)
		else:
			switch_to(PlayerStateBlackboard.States.IDLE)
	
	elif (get_blackboard().is_falling() 
		and get_blackboard().is_on_stairs()
	):
		switch_to(PlayerStateBlackboard.States.CLIMB_STAIRS)
	
	elif (_jump_timer.time_left == 0 
		and input_climb_wall()
	):
		# 刚跳起的时间内不可立即切换为爬墙
		switch_to(PlayerStateBlackboard.States.CLIMB_WALL)
	


